<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.bootcdn.net/ajax/libs/axios/1.2.1/axios.js"></script>
</head>

<body>
    <ul class="list">
        <li></li>
    </ul>
    <button>获取电影</button>
    <button>添加电影</button>
    <button>修改电影</button>
    <button>局部修改</button>
    <button>删除电影</button>
    <script>
        // 获取ul和按钮
        let ul = document.querySelector('ul');
        let btns = document.querySelectorAll('button');

        //获取电影列表
        btns[0].onclick =async function(){
           let {data} = await axios('http://www.zhibao.com/movies');
        //    console.log(data);
            ul.innerHTML = data.map(item=>`<li>${item.name}</li>`).join('')
        }

        // 添加电影
        btns[1].onclick =async function(){
            let res =await axios('http://www.zhibao.com/movies',{
                method:"post",
                data:{
                    name:"王者荣耀",
                    director:"马化腾",
                    star:"上官婉儿"
                }
            })
            console.log(res);
        }
        
    
        // 修改电影
        

        // 局部修改
        
    
        // 删除电影
        
    </script>
</body>

</html>